package com.learner.exam.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.learner.pojo.exam.ExamRecord;
import com.learner.pojo.exam.vo.PageResponse;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author ice2020x
 * @Date: 2023/3/7
 * @Description: 考试记录
 **/
public interface ExamRecordService extends IService<ExamRecord> {

    /**
     * 根据用户id和考试id获取考试记录
     *
     * @param userId   用户名
     * @param examId   考试id
     * @param page     页
     * @param pageSize 页大小
     * @return ExamRecord
     */
    PageResponse<ExamRecord> getUserGrade(String userId, Integer examId, Integer page, Integer pageSize);


    /**
     * 创建考试证书
     *
     * @param examName     考试名
     * @param examRecordId 考试记录id
     * @param response     response
     */
    void createExamCertificate(HttpServletResponse response, String examName, Integer examRecordId);

    /**
     * 根据id获取考试记录
     *
     * @param recordId 记录id
     * @return ExamRecord
     */
    ExamRecord getExamRecordById(Integer recordId);

    /**
     * 添加考试记录
     *
     * @param examRecord 考试记录
     * @param request    request
     * @return 结果
     */
    Integer addExamRecord(ExamRecord examRecord, HttpServletRequest request);

    /**
     * 根据考试id获取考试记录
     *
     * @param examId   考试id
     * @param page     页码
     * @param pageSize 页大小
     * @return 结果
     */
    PageResponse<ExamRecord> getExamRecord(Integer examId, Integer page, Integer pageSize);

    /**
     * 设置考试分数
     *
     * @param totalScore   分数
     * @param examRecordId 考试记录id
     */
    void setObjectQuestionScore(Integer totalScore, Integer examRecordId);
}
